var t = require;
var e = module;
var o = exports;
var a,
    i =
        (this && this.__extends) ||
        ((a = function (t, e) {
            return (a =
                Object.setPrototypeOf ||
                ({__proto__: []} instanceof Array &&
                    function (t, e) {
                        t.__proto__ = e;
                    }) ||
                function (t, e) {
                    for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
                })(t, e);
        }),
        function (t, e) {
            a(t, e);
            function o() {
                this.constructor = t;
            }
            t.prototype = null === e ? Object.create(e) : ((o.prototype = e.prototype), new o());
        }),
    n =
        (this && this.__decorate) ||
        function (t, e, o, a) {
            var i,
                n = arguments.length,
                r = n < 3 ? e : null === a ? (a = Object.getOwnPropertyDescriptor(e, o)) : a;
            if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(t, e, o, a);
            else
                for (var s = t.length - 1; s >= 0; s--)
                    (i = t[s]) && (r = (n < 3 ? i(r) : n > 3 ? i(e, o, r) : i(e, o)) || r);
            return n > 3 && r && Object.defineProperty(e, o, r), r;
        };
Object.defineProperty(o, "__esModule", {value: !0});
var r = t("UIBase"),
    s = t("BuySkillItem"),
    c = cc._decorator,
    p = c.ccclass,
    l =
        (c.property,
        c.menu,
        (function (t) {
            i(e, t);
            function e() {
                var e = (null !== t && t.apply(this, arguments)) || this;
                e.listView = [];
                return e;
            }
            e.prototype.onShowEnd = function () {
                this.initView();
                EVUIEffView.on(EVUIEffView.updateBtn, this.checkBtn.bind(this), this);
                this.openGuild();
            };
            e.prototype.openGuild = function () {
                if (!GuildCache.isOverOnceGuid(GuildCache.oncecheckId[3][1])) {
                    GuildCache.checkKey = GuildCache.oncecheckId[3][1];
                    GuildCache.overOnceGuid(GuildCache.oncecheckId[3][1]);
                    GuildCache.openGuildView();
                }
            };
            e.prototype.checkBtn = function () {
                this.initView();
            };
            e.prototype.onCloseStart = function () {
                for (var t = 0; t < this.listView.length; t++) QLooperNode.putNode(this.listView[t]);
                EVUIEffView.offTarget(this);
            };
            e.prototype.initView = function () {
                var t = CacheDataManager.getUpgrade();
                if (t)
                    for (var e = Object.keys(t), o = 0; o < e.length; o++)
                        this.viewItem(t[e[o]], o, 0.05 * Math.floor(o / 2));
                CacheDataManager.updateCostDataView = !0;
            };
            e.prototype.viewItem = function (t, e, o) {
                var a = this;
                this.scheduleOnce(function () {
                    var o = null;
                    if (a.listView[e]) o = a.listView[e];
                    else {
                        o = QLooperNode.getNode(QLooperNode.tag_buySkillItem);
                        a.listView.push(o);
                    }
                    o.parent = a._content;
                    var i = o.getComponent(s.default);
                    null == i || i.setRewardKind(t, e + 1 + "");
                }, o);
            };
            e.prototype.clickFirst = function () {
                0 < this.listView.length && this.listView[0].getComponent(s.default).clickItem();
            };
            return n([p], e);
        })(r.default));
o.default = l;
